package com.tz.farmer.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.tz.farmer.model.AuthenticationInfo;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;


public interface AuthenticationInfoMapper extends BaseMapper<AuthenticationInfo> {

    @Select("select   a.id,  a.auth_type,  a.number,  a.product_name,  a.yield,  a.create_time,  a.term_time,  a.lead_id , b.city from authentication_info a INNER JOIN business_info b  on b.id = a.lead_id  where b.is_delete = 0 and lead_id = #{leadId}")
    List<AuthenticationInfo> selectAuthByLeadId(@Param("leadId")Integer leadId);

    @Select("select  count(0) from authentication_info a INNER JOIN business_info b  on b.id = a.lead_id  where b.is_delete = 0  and lead_id = #{leadId}")
    int countNum(@Param("leadId")Integer leadId);

    @Select("select  count(0) from authentication_info a INNER JOIN business_info b  on b.id = a.lead_id  where b.is_delete = 0  and lead_id = #{leadId} and product_name =#{productName} ")
    int selectCountOne(@Param("productName") String productName,@Param("leadId") Integer leadId);
}
